package org.gl.training.planner.dao;

import org.gl.training.planner.model.Task;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

@Repository(value = "taskDao")
public class TaskDaoImpl extends HibernateDaoSupport implements TaskDao {

	@Autowired
	public void init(SessionFactory factory) {
		setSessionFactory(factory);
	}

	@Override
	public void delete(Task task) {
		getHibernateTemplate().delete(task);
	}

	@Override
	public void save(Task task) {
		getHibernateTemplate().merge(task);
	}
}
